package bitcarve.hydra.core.time
{
	import flash.display.Scene;
	
	public class TimePoint
	{
		public static var ZERO:TimePoint = new TimePoint(0);
		
		public static var SECOND:int = 0;
		public static var FRAME:int = 1;
		public static var MILLISECOND:int = 2;
		
		public static var FRAMERATE:Number = 1;
		
		private var _second:Number;
		private var _frame:int;
		private var _millisecond:int;
		
		public function TimePoint( value:int,  type:int = 1)
		{
			switch(type)
			{
				case SECOND:
					Second = value;
					break;
				case FRAME:
					Frame = value;
					break;
				case MILLISECOND:
					MilliSecond = value;
					break;
				default:
					MilliSecond = value;
					break;					
			}
		}
		
		public function set Second(value:Number):void
		{
			_second = value;
			_frame = value * FRAMERATE;
			_millisecond = value * 1000;
		}
		public function get Second():Number
		{
			return _second;
		}
		
		public function set Frame(value:int):void
		{
			_second = value / FRAMERATE;
			_frame = value;
			_millisecond = value / FRAMERATE * 1000;
		}
		public function get Frame():int
		{
			return _frame;
		}
		
		public function set MilliSecond(value:int):void
		{
			_second = value / 1000;
			_frame = value / 1000 * FRAMERATE;
			_millisecond = value;
		}
		public function get MilliSecond():int
		{
			return _millisecond;
		}		
		
	}
	
}
